home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / IO Examples / IO Utilities / Highscore.dcl < prev    next >
Encoding:
Modula Definition  |  1996-12-18  |  991 b   |  34 lines  |  [TEXT/3PRM]

  1. definition module Highscore
  2.  
  3. /*
  4.     General utility for reading/writing high scores to Files and displaying current high scores.
  5.     This module uses the 0.8 I/O library.
  6. */
  7.  
  8. from    StdFile            import    Files
  9. from    StdString        import    String
  10. from    deltaEventIO    import    IOState
  11. from    deltaIOSystem    import    DialogId
  12.  
  13. ::    *HiScores    :== (!Files,!Highs)
  14. ::    Highs        :== [High]
  15. ::    High
  16.     =    {    name    :: !String
  17.         ,    score    :: !Int
  18.         }
  19.  
  20. // Read high score file from disk:
  21. ReadHiScores    :: !String !Files        -> (!*File,!HiScores)
  22.  
  23. // Write high scores to disk:
  24. WriteHiScores    :: !*File  !HiScores    -> Files
  25.  
  26. //    Determine whether, given the number of high scores, a given score is actually a new high score:
  27. ItsAHighScore    :: !Int !Int !Highs        -> Bool
  28.  
  29. //    Add, given the number of high scores, a High to the current list of high scores:
  30. AddScore        :: !Int !High !Highs    -> Highs
  31.  
  32. // Display current high scores to user in a modal dialog with given DialogId:
  33. ShowHiScores    :: DialogId String !Highs !*s !(IOState *s)    -> (!*s,!IOState *s)
  34.